package net.quindu.android.smsfilter;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

    private static final int DATABASE_VERSION = 5;
    private static final String DATABASE_NAME = "sms";


    DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
		String sql;
		sql = "create table sms_folder ( folder_id integer primary key autoincrement, title text not null);";   	
        db.execSQL(sql);
        
        sql = "create table sms_filter ( filter_id integer primary key autoincrement, title text not null);";
        db.execSQL(sql);
        
        sql = "create table sms_action ( _id integer primary key autoincrement, filter_id integer, type_id integer, val text);";
        db.execSQL(sql);
        
        sql = "create table sms_condition ( _id integer primary key autoincrement, filter_id integer, type_id integer, val text);";
        db.execSQL(sql);        
        
    }

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		String sql;
//        sql = "create table sms_filter ( filter_id integer primary key autoincrement, title text not null);";
//        db.execSQL(sql);	
//        sql = "create table sms_action ( _id integer primary key autoincrement, filter_id integer, type_id integer, val text);";
//        db.execSQL(sql);
//        
//        sql = "create table sms_condition ( _id integer primary key autoincrement, filter_id integer, type_id integer, val text);";
//        db.execSQL(sql);   	
		
		
		
	}
}